<?php
/**
 * +--------------------------------------------------------------
 * | eLuoPHP
 * +--------------------------------------------------------------
 * | Copyright (c) 2013-2019 http://qxwoo.cn All rights reserved.
 * +--------------------------------------------------------------
 * | y139w [y139w@163.com]
 * +--------------------------------------------------------------
 * | 框架通用文件
 * +--------------------------------------------------------------
 */

defined('APP_PATH') or define('APP_PATH', './application/');
define('DS'           , DIRECTORY_SEPARATOR);
define('EXT'          , '.php');
define('ROOT_PATH'    , realpath(__DIR__ . DS . '../') . DS);
define('FRAME_PATH'   , __DIR__ . DS);
define('CORE_PATH'    , FRAME_PATH . 'libs' . DS);
define('CONF_PATH'    , ROOT_PATH . 'config' . DS);
define('ROUTE_PATH'   , ROOT_PATH . 'route' . DS);
define('CONFIG_EXT'   , '.php');
define('RUNTIME_PATH' , ROOT_PATH . 'runtime/');
define('EXTEND_PATH'  , ROOT_PATH . 'extend' . DS);

// 引入自动加载类文件
include CORE_PATH . 'Loader.php';
require __DIR__ . '/helper.php';
// 实例化自动加载类
$loader = \luo\Loader::instance();
// 注册命名空间
$loader->addNamespaceArray([
    'luo'           => ['dirpath' => ROOT_PATH . './eluo/libs'           , 'prepend' => 0],
    'luo\cache'     => ['dirpath' => ROOT_PATH . './eluo/libs/cache'     , 'prepend' => 0],
    'luo\db'        => ['dirpath' => ROOT_PATH . './eluo/libs/db'        , 'prepend' => 0],
    'luo\db\driver' => ['dirpath' => ROOT_PATH . './eluo/libs/db/driver' , 'prepend' => 0],
    'luo\response'  => ['dirpath' => ROOT_PATH . './eluo/libs/response'  , 'prepend' => 0],
    'luo\exception' => ['dirpath' => ROOT_PATH . './eluo/libs/exception' , 'prepend' => 0],
    'luo\ioc'       => ['dirpath' => ROOT_PATH . './eluo/ioc'            , 'prepend' => 0],
    'luo\traits'    => ['dirpath' => ROOT_PATH . './eluo/traits'         , 'prepend' => 0],
    'luo\extend'    => ['dirpath' => ROOT_PATH . './eluo/extend'         , 'prepend' => 0],
    'app'           => ['dirpath' => ROOT_PATH . APP_PATH                , 'prepend' => 0]
])->register();

\luo\Error::register();

\luo\Config::set(include FRAME_PATH . 'configurations.php');
